home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SCRIPT.PAK / DEBUG.SPP < prev    next >
Text File  |  1997-05-06  |  5KB  |  224 lines

  1. //----------------------------------------------------------------------------
  2. // cScript
  3. // (C) Copyright 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. // DEBUG.SPP
  6. //    Provides support services for debugging operations.
  7. //
  8. // $Revision:   1.59  $
  9. //
  10. //----------------------------------------------------------------------------
  11.  
  12. import editor;
  13. import IDE;
  14.  
  15. import "bcwdbg.dll" {
  16.    void SetEIPToCurrent();
  17. }
  18.  
  19.  
  20. // mark this module as being a library module
  21. library;
  22.  
  23. export debugger = new Debugger();
  24.  
  25. //
  26. // Debugger Object Handlers.
  27. //
  28.  
  29. on debugger:>SetEIPToSelected(){
  30.    SetEIPToCurrent();
  31. }
  32.  
  33. on debugger:>AddBreakAtCurrent(){
  34.    declare fileName = editor.TopBuffer.FullName;
  35.    declare row = editor.TopBuffer.TopView.Position.Row;
  36.    .AddBreakpointFileLine(fileName, row);
  37. }
  38.  
  39. on debugger:>WatchCurrent(){
  40.    if (IsEditKeyboard())
  41.       debugger.AddWatch(editor.GetWord(), FALSE);
  42. }
  43.  
  44. on debugger:>ModifyCurrent(){
  45.    debugger.EvaluateWindow(editor.GetWord());
  46. }
  47.  
  48. on debugger:>EvaluateCurrent(){
  49.    if (IsEditKeyboard())
  50.        debugger.EvaluateWindow(editor.GetWord());
  51. }
  52.  
  53. on debugger:>InspectCurrent(){
  54.    if (IsEditKeyboard()) {
  55.       declare topView = editor.TopView;
  56.       debugger.Inspect(editor.GetWord(), topView, topView.Position.Row,
  57.           topView.Position.Column, FALSE);
  58.    }
  59. }
  60.  
  61. on debugger:>ToggleBreakpoint(declare fileName, declare row){
  62.    if (!initialized(fileName)) {
  63.       if (initialized(editor.TopBuffer))
  64.          if (editor.TopBuffer != NULL)
  65.             fileName = editor.TopBuffer.FullName;
  66.    }
  67.    if (!initialized(row)) {
  68.       if (initialized(editor.TopBuffer))
  69.          if (editor.TopBuffer != NULL)
  70.             if (initialized(editor.TopBuffer.TopView))
  71.                 if (editor.TopBuffer.TopView != NULL )
  72.                    row = editor.TopBuffer.TopView.Position.Row;
  73.    }
  74.  
  75.    pass(fileName, row);
  76. }
  77.  
  78. on debugger:>ViewCpuFileLine(declare fileName, declare row ){
  79.     fileName = editor.TopBuffer.FullName;
  80.     row = editor.TopBuffer.TopView.Position.Row;
  81.     pass(fileName, row);
  82. }
  83.  
  84. on debugger:>RunToCurrent(){
  85.    if (IDE.KeyboardManager.GetKeyboard() == IDE.KeyboardManager.GetKeyboard("CPU"))
  86.       debugger.RunToAddress();
  87.    else if (IsEditKeyboard())
  88.    {
  89.        declare fileName = editor.TopBuffer.FullName;
  90.        declare row = editor.TopBuffer.TopView.Position.Row;
  91.        debugger.RunToFileLine(fileName, row);
  92.    }
  93. }
  94.  
  95. //
  96. // IDE Object Debug Menu Debugger Handlers.
  97. //
  98.  
  99. on IDE:>DebugAddBreakpoint(){
  100.    if (IsEditKeyboard()) {
  101.         debugger.AddBreakAtCurrent();
  102.     } else {
  103.         debugger.AddBreakpoint();
  104.     }
  105. }
  106.  
  107. on IDE:>DebugAddWatch(){
  108.    if (IsEditKeyboard()) {
  109.        debugger.AddWatch(editor.GetWord(), TRUE);
  110.     } else {
  111.        debugger.AddWatch();
  112.     }
  113. }
  114.  
  115. on IDE:>DebugAnimate(){
  116.     debugger.Animate();
  117. }
  118.  
  119. on IDE:>DebugProfile(){
  120.     debugger.ViewProfile();
  121. //    debugger.RunToFileLine( "--PROFILE--", -1 );
  122. }
  123.  
  124. on IDE:>DebugAttach(declare Process){
  125.    debugger.Attach(Process);
  126. }
  127.  
  128. on IDE:>DebugBreakpointOptions(){
  129.     debugger.BreakpointOptions();
  130. }
  131.  
  132. on IDE:>DebugEvaluate(){
  133.    if (IsEditKeyboard()) {
  134.         debugger.EvaluateWindow(editor.GetWord());
  135.    } else {
  136.         debugger.EvaluateWindow();
  137.    }
  138. }
  139.  
  140. on IDE:>DebugInspect(){
  141.    if (IsEditKeyboard()) {
  142.        debugger.Inspect(editor.GetWord(), 0, 0, 0, TRUE);
  143.     } else {
  144.        debugger.Inspect("", 0, 0, 0, TRUE);
  145.     }
  146. }
  147.  
  148. on IDE:>DebugInstructionStepInto(){
  149.    debugger.InstructionStepInto();
  150. }
  151.  
  152. on IDE:>DebugInstructionStepOver(){
  153.     debugger.InstructionStepOver();
  154. }
  155.  
  156. on IDE:>DebugLoad(declare Process){
  157.    debugger.Load(Process);
  158. }
  159.  
  160. on IDE:>DebugPauseProcess(){
  161.    debugger.PauseProgram();
  162. }
  163.  
  164. on IDE:>DebugResetThisProcess(){
  165.    debugger.Reset();
  166. }
  167.  
  168. on IDE:>DebugRun() {
  169.    debugger.Run();
  170. }
  171.  
  172. on IDE:>DebugRunTo(){
  173.       debugger.RunToFileLine();
  174. }
  175.  
  176. on IDE:>DebugSourceAtExecutionPoint(){
  177.    debugger.FindExecutionPoint();
  178. }
  179.  
  180. on IDE:>DebugStatementStepInto(){
  181.     debugger.StatementStepInto();
  182. }
  183.  
  184. on IDE:>DebugStatementStepOver(){
  185.     debugger.StatementStepOver();
  186. }
  187.  
  188. on IDE:>DebugTerminateProcess(){
  189.     debugger.TerminateProgram();
  190. }
  191.  
  192. //
  193. // IDE Object View Menu Debugger Handlers.
  194. //
  195.  
  196. on IDE:>ViewModule(){
  197.     debugger.ViewModule();
  198. }
  199.  
  200. on IDE:>ViewBreakpoint(){
  201.     debugger.ViewBreakpoint();
  202. }
  203.  
  204. on IDE:>ViewCallStack(){
  205.     debugger.ViewCallStack();
  206. }
  207.  
  208. on IDE:>ViewCpu(){
  209.    debugger.ViewCpu();
  210. }
  211.  
  212. on IDE:>ViewProcess(){
  213.     debugger.ViewProcess();
  214. }
  215.  
  216. on IDE:>ViewWatch(){
  217.     debugger.ViewWatch();
  218. }
  219.  
  220.  
  221.  
  222.  
  223.  
  224.